def BinaryTree(r):
    return [r,[],[]]

def insertLeft(root,newBranch):
    t = root.pop(1)
#29行中r替换了root，b替换了newbranch
    if len(t)>1:
        
        root.insert(1,[newBranch,[],[]])
    else:
        root.insert(1,[newBranch,[],[]])
    return root
def insertRight(root,newBranch):
    t=root.pop(2)
    if len(t)>1:        
        root.insert(2,[newBranch,[],t])
    else:
        root.insert(2,[newBranch,[],[]])
    return root

def getRootVal(root):
    return root[0]

def setRootVal(root,newVal):
    root[0]=newVal
    
def getLeftChild(root):
    return root[1]
def getRightChild(root):
    return root[2]
    
r=BinaryTree("a")
insertRight(r,"b")
insertRight(r,"c")
r_l = getLeftChild(r)
r_r = getRightChild(r)
insertLeft(r_l,"d")
insertRight(r_l,"e")
insertLeft(r_r,"f")
print(r)
print(r_l)
print(r_r)